<template>
	<div class="header-wrap">
		<header>
			<div class="header-left">
				<i class="iconfont"></i>
			</div>

			<div class="header-title">
				<slot>{{title}}</slot>
			</div>

			<div class="header-right">
				 <slot name="right"></slot>
			</div>
		</header>
	</div>
</template>

<script type="text/javascript">
	export default {

		props: {
			title: [String],
		},

		methods: {
			back(myurl) {
				if (myurl) {
					this.$router.push(myurl);
				} else {
					this.$router.go(-1);
				}
			}
		}
	}
</script>

<style type="text/css" lang="scss" scoped>
	.header-wrap {
		height: 44px;
	}
	header {
		position: fixed;
		top: 0;
		z-index: 101;
		width: 100%;
		height: 44px;
		display: flex;
		justify-content: space-between;
		align-items: center;
		overflow: hidden;
		background: #FFFFFF;
		box-shadow: 0 0 0 0 rgba(0,0,0,0.15);
		padding: 0 16px;
		/*position: relative;*/

		&:after {
			content: '';
			width: 100%;
			height: 1px;
			position: absolute;
			left: 0;
			bottom: 0;
			background: #E5E5E5;
			transform: scaleY(.5);
		}

		.header-left {
			position: relative;
			left: -4px;
			width: 70px; 
			display: flex;
			align-items: center;
			justify-content: flex-start;
			flex-shrink: 0;
			height: 100%;

			i {
				font-size: 18px;
				color: #666;
			}
		}

		.header-title {
			overflow: hidden;
			white-space: nowrap;
			text-overflow: ellipsis;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 20px;
			color: #303030;
			flex-grow: 1; 
		}

		.header-right {
			width: 70px; 
			flex-shrink: 0;
			align-items: center;
			text-align: right;
		}
	}
</style>